﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Infrastructure.Annotations;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EfSandbox.Entities.Final.Common.Mappings {
    public class CategoryMap : EntityTypeConfiguration<Category> {
        public CategoryMap() { 
            // Table
            ToTable("fin.com_categories");

            // Primary Key
            HasKey(c => c.CategoryId);

            // Attributes
            Property(c => c.CategoryId)
                .IsRequired()
                .HasColumnName("cat_id");
            
            Property(c => c.CategoryName)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(250)
                .HasColumnName("cat_desc");

            Property(c => c.CategoryCode)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(250)
                .HasColumnName("cat_cd"); 
        }
    }
}
